<?php
include_once('common/header.php');
if($AppUI->id < 0 || !isset($_SERVER['HTTP_REFERER'])) {
	Vfriend_Function::redirect(HOST_VFRIEND);
} 
$objRequest 	= $this->_request;
$strKeyword 	= trim($objRequest->getParam('val', ''));
$intProvince 	= trim($objRequest->getParam('province', 0));
$intDistrict 	= trim($objRequest->getParam('district', 0));
if (strlen($strKeyword) > 2 && $intProvince) {
	$objPlace 	= new Place();
	$arrResult 	= $objPlace->getSmartSearch($strKeyword,$intProvince,$intDistrict);
	$this->view->arrResult = $arrResult;
	$objView 	= Zend_Registry::get('objView');
	$strData	= $objView->fetch('ajax/smart-search-offline.tpl');
	$arrJson 	= array('data'=>$strData);
	echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
}
exit();
?>